package april.test_4_20;

import java.util.Scanner;

public class TestMain1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[][] arr = new int[n][2];
        for (int i = 0; i < n; i++) {
            int a = scanner.nextInt();
            arr[i][0] = a;
        }
        for (int i = 0; i < n; i++) {
            int a = scanner.nextInt();
            arr[i][1] = a;
        }
        int max = 0;
        for (int i = 0; i < n; i++) {
            int count = 0;
            int x = arr[i][0];
            int y = arr[i][1];
            for (int j = 0; j < n; j++) {
                if(Math.abs(x - arr[j][0]) + Math.abs(y - arr[j][1]) <= k) {
                    count++;
                }
            }
            max = Math.max(max,count);
        }
        System.out.println(max);
    }
}
